package com.kclm.pojo;

import org.springframework.beans.factory.FactoryBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author : lvhx
 * @Date: 2025/11/3 16:31
 * @Description:
 */
public class DateFactoryBean implements FactoryBean<Date> {
    private String dateStr;

    public void setDateStr(String dateStr) {
        this.dateStr = dateStr;
    }

    @Override
    public Date getObject() throws Exception {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date  date = simpleDateFormat.parse(this.dateStr);
        return date;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }

    @Override
    public boolean isSingleton() {
        // true 单例的   false  原型
        return true;
    }
}
